<!DOCTYPE html>
 <html>
 <head>
 <meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
 <% include("/WEB-INF/view/console/common/css.html"){}	%>
 <% include("/WEB-INF/view/console/common/js.html"){} 	%>
 <title></title>
 </head>
 <body> <nav class="navbar navbar-default navbar-fixed-top site-navbar" >
  <div class="navbar-header">
 <a class="navbar-brand" href="#">sysRole</a>
 </div>
  </nav>
 <form name="sysRole_form"  id="sysRole_form" class="form-horizontal" style="margin-top: 60px;">
   <div class="form-group" >
 <label class="col-sm-2 control-label">角色名</label>
 <div class="col-sm-6">
 <input  type="text"  name="roleName" id="roleName" class="form-control" check-type="required" value='${sysRole.roleName!}' >
 </div>
  </div>
 <div class="form-group" >
 <label class="col-sm-2 control-label">状态</label>
 <div class="col-sm-6">
 <label><input checked='checked' auto_name='sysRole_status' type="radio"  name="status" value="0"/>禁用</label>
 <label><input  auto_name='sysRole_status' type="radio"  name="status" value="1"/>可用</label>
  
 </div>
  </div>
 	<script type="text/javascript">
       $(function($){
       $('input[auto_name="sysRole_status"]').each(function(){
       if('${sysRole.status!}'==this.value){ 
             $(this).attr('checked','checked');
            }
           });
 	    });
 	</script> 
 <div class="form-group" >
 <label class="col-sm-2 control-label">上级角色ID</label>
 <div class="col-sm-6">
 <input  type="text"  name="pid" id="pid" class="form-control" check-type="required" value='${sysRole.pid!}' >
 </div>
  </div>
 
   <input type='hidden' name='roleId' id='roleId' value='${sysRole.roleId!}'><input type='hidden' name='common_token' id='common_token' value='${common_token!}'>
 <div class="form-group" style="margin-bottom: 60px;"></div>
 </form>
 <script type="text/javascript">
 $(function($) {
    /*开启表单验证*/
 	$("#sysRole_form").validation();
 });
 /*保存*/
 function saveZqForm(){
    if ($("#sysRole_form").valid() == false) {
 	    return false;
    }
    var formObject=new Object();
    formObject.roleName=$('#roleName').val()==''?null:$('#roleName').val(); 
 formObject.status=($('input[name="status"]:checked').val()==''?null:$('input[name="status"]:checked').val()); 
 formObject.pid=$('#pid').val()==''?null:$('#pid').val(); 
 formObject.roleId=$('#roleId').val()==''?null:$('#roleId').val(); 
 
    var formObjectJson = JSON.stringify(formObject);
    $.post("${ctxPath}/console/sys_role/save",
     {
           formObjectJson :formObjectJson,
 	   table_name :'sysRole',
 	   common_token :$("#common_token").val()
     }, function(data) {
          $.alert({
 	      title: '提示',
 	      content: data.message,
 	      backgroundDismiss: false,
 	      confirmButton:"确定",
 	      autoClose: 'confirm|2000',
 		  confirm: function(){
            parent.$("#sysRole").bootstrapTable("refresh");
            parent.art.dialog.get('id-dialog-sysRole').close();
 		  }
 		});
     });
 }
 </script>
 <nav class="navbar navbar-default navbar-fixed-bottom site-navbar" >
 <div class="container" style="padding-top:10px;padding-bottom:10px;">
 <div class="nav navbar-nav navbar-right">
 <a href="#" class="btn btn-success"  onclick='saveZqForm()'>保存 </a>
  </div>
  </div>
  </nav>
 </body>
